#define _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>

//int atoi(const char* str);
int my_atoi(const char* p)
{
	const char* k = p;
	while (!(0 <= *k <= 9) || !(*k == '-' && 0 <= *(k + 1) <= 9))
	{
		k++;
	}
    int* t = k;
	int y = 0;
	int count = 1;
	while ((0 <= *t <= 9) || *k == '-' && 0 <= *(t + 1) <= 9)
	{
		*t *= count;
		y += *t;
		count *= 10;
	}
	return y;
}
int main()
{
	char arr = "\nhudshjd5445465054sfdvsdv41d";
	int x = my_atoi(arr);
	printf("%d\n", x);
}